﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IPagination<UserInput>>" %>
<%@ Import Namespace="Kanban.Dto"%>
<%@ Import Namespace="MvcContrib.Pagination"%>
<%@ Import Namespace="MvcContrib.UI.Grid"%>
<%@ Import Namespace="MvcContrib.UI.Pager"%>
<%@ Import Namespace="MvcContrib.UI.Grid.ActionSyntax"%>
<%@ Import Namespace="WebUI.Controllers"%>
<%@ Import Namespace="WebUI.Presentation"%>
<%@ Import Namespace="KanbanBoard.Core"%>
<%@ Import Namespace="Microsoft.Web.Mvc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContentTitlePlaceHolder" runat="server">
    <h2>Clients</h2>

 <script type="text/javascript">

     function CreateUser() {
         resultHTML = jQuery.ajax({
             type: 'GET',
             url: 'User/Index'
         }).responseText;
         $('#notification').html(resultHTML);
     }
     
     function PostComment(UserID)
        jQuery.ajax({
        type: 'POST',
        data: $('#commentForm').serialize(),
        url: 'Comments/Add',
        success: function(result){ 
            $('#comments').html(result);


            }
        }
    });

 
 </script>
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

    <% if (ViewContext.TempData[GlobalEnums.TempDataProperty.PageMessage.ToString()] != null) { %>
        <p id="pageMessage"><%= ViewContext.TempData[GlobalEnums.TempDataProperty.PageMessage.ToString()]%> </p>
    <% } %>

    <div>
        <%= Html.ActionImage<UserController>(c => c.Create(), "content/images/add.ico", "Create New Client", null, null, new { @class = "add" })%>
        <% Html.Grid(Model).Columns(column =>
        {
        column.For(x => x.LoginName);
        column.For(x => x.FirstName);
        column.For(x => x.Surname);
        column.For("Actions").Named("Actions").Action(p =>
               {%><td>
                    <% var fid = Guid.NewGuid();
                       using (Html.BeginForm<UserController>(c => c.Delete(p.Id), FormMethod.Post, new { id = fid }))
                       { %><%= Html.AntiForgeryToken()%>
                        <%=Html.ActionImage<UserController>(c => c.Show(p.Id), "content/images/view.ico", "Details ")%>
                        <%=Html.ActionImage<UserController>(c => c.Edit(p.Id), "content/images/edit.ico", "Edit")%>
                        <a href="#" onclick="ConfirmeDialog('<%= fid %>'); return false;" ><img src="content/images/delete.ico" alt=""/></a>
                    <% } %>
                  </td><%});
        }).Attributes(@class => "grid", width => 770).RenderUsing(new FooterTableGridRender<UserInput>()).Render();%>
        <br />
        <%= Html.Pager(Model) %>
    </div>
    
</asp:Content>